package com.lqq.controller.restfull;

import com.lqq.service.MyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lqq
 * @date 2019/1/6
 */
@RestController
@Api(description = "index")
public class IndexController {


    @RequestMapping({"", "/" , "/index"})
    @ApiOperation(value = "index",httpMethod = "GET")
    public String index() throws UnknownHostException {
        InetAddress address = InetAddress.getLocalHost();
        return  "indexMethod: 当前主机ip地址信息：" + address.getHostAddress();
    }

    @RequestMapping({"/hello"})
    @ApiOperation(value = "hello",httpMethod = "GET")
    public String getIP() throws UnknownHostException {
        InetAddress address = InetAddress.getLocalHost();
        //System.out.println(address.getHostName());//主机名
        //System.out.println(address.getCanonicalHostName());//主机别名
        //System.out.println(address.getHostAddress());//获取IP地址
        return  "helloMethod: 当前主机ip地址信息：" + address.getHostAddress();
    }

}
